home *** CD-ROM | disk | FTP | other *** search
- ***********************************************************
- * This little program shows how to use the BPLxMOD registers
- * to produce a neat "scroll".
- * 1992 Epsilon
- ***********************************************************
-
- WaitVblank MACRO
- .\@ move.l 4(a5),d0
- andi.l #$3ff00,d0
- cmpi.l #$0f400,d0
- bne.b .\@
- ENDM
-
- ***********************************************************
-
- bsr.w TakeSystem
- MouseWait: WaitVblank
-
- bsr.s Roll
-
- btst #6,$bfe001
- bne.s MouseWait
-
- bsr.w RestoreSystem
- rts ; Done!
-
- ***********************************************************
-
- Roll: move.w skip,d0 ; can't compare memory locations
- cmp.w WAIT,d0 ; update every WAIT
- bne.s no_roll ; VBlanks
- clr.w skip
-
- lea wavestart+6,a1 ; first line to wave in copper
- cmpi.w #8,Roll_Count ; is text all the way up?
- bne.s roll_it
- clr.w Roll_Count ; reset counter
- neg.w Roll_Dir ; reverse scroll direction
-
- roll_it: move.w Roll_Dir,d0 ; can't add memory loactions
- add.w d0,(a1) ; skip another line show up.
- addq.w #1,Roll_Count ; increment counter
-
- tst.w (a1) ; is text in center position?
- bne.s normal_wait
- move.w #60,WAIT ; wait longer so they can read it
- bra.s no_roll
- normal_wait: move.w #10,WAIT ; move it faster
-
- no_roll: addq.w #1,skip
- rts
-
- ***********************************************************
-
- TakeSystem: move.l #$dff000,a5 ; Custom chip base
-
- bsr.w InstallBmap
- bsr.w InstallSprites
- move.l #Copper,$80(a5) ; install copper
- rts ; Done
-
- ***********************************************************
-
- RestoreSystem: move.l #$dff000,a5 ; Custom chip base
-
- movea.l 4.w,a6 ; ExecBase
- lea GraphicsName,a1 ; "graphics.library"
- jsr -$198(a6) ; OpenLibrary()
- move.l d0,a1 ; Copy ptr to GfxBase
- move.l $26(a1),$80(a5) ; Install old system copperlist
- jsr -$19e(a6) ; CloseLibrary()
- rts ; Done
-
- ***********************************************************
-
- InstallBmap: lea bmapptrs,a0
- move.l #Bmap,d0 ; say our bmap address is $12345678
- move.w d0,6(a0) ; write $5678 to $e2 reg in copper
- swap d0 ; list, and
- move.w d0,2(a0) ; write $1234 to $e0
- rts
-
- ***********************************************************
-
- InstallSprites: lea sprptrs,a0 ; this causeses all sprites
- move.l #NullSprite,d0 ; to be just blank data.
- move.w d0,6(a0) ; The same effect could have
- move.w d0,14(a0) ; been achieved by just shutting
- move.w d0,22(a0) ; off sprite DMA.
- move.w d0,30(a0)
- move.w d0,38(a0)
- move.w d0,46(a0)
- move.w d0,54(a0)
- move.w d0,62(a0)
- swap d0
- move.w d0,2(a0)
- move.w d0,10(a0)
- move.w d0,18(a0)
- move.w d0,26(a0)
- move.w d0,34(a0)
- move.w d0,42(a0)
- move.w d0,50(a0)
- move.w d0,58(a0)
- rts
-
- ***********************************************************
-
- section amazin_fruit,data
-
- WAIT: dc.w 40
- Roll_Dir: dc.w 40
-
- Roll_Count: dc.w 0
- skip: dc.w 0
-
- GraphicsName: dc.b 'graphics.library',0
- EVEN
-
- ***********************************************************
-
- section squid,data_c
-
- Copper: dc.w $0100,$1200 ; bit plane control reg.0
- dc.w $0102,$0000 ; scroll value
- dc.w $0104,$0000 ; blp/sprite priority reg.
- dc.w $0108,$0000 ; odd bitplane modulo value
- dc.w $010a,$0000 ; even bitplane modulo value
- dc.w $0180,$0000 ; color00 = black
- dc.w $0182,$0000 ; color01 = black
- dc.w $008e,$2c81 ; upper left corner of disp. window
- dc.w $0090,$f4c1 ; lower right corner of disp. window
- dc.w $0092,$0038 ; start of bpl. (horizontal)
- dc.w $0094,$00d0 ; end of bpl. (horizontal)
- bmapptrs:dc.w $00e0,$0000 ; adr of bplane 1 (long - 2 words)
- dc.w $00e2,$0000 ; low word of bplane 1 adr
- sprptrs:dc.w $0120,$0000,$0122,$0000,$0124,$0000,$0126,$0000
- dc.w $0128,$0000,$012a,$0000,$012c,$0000,$012e,$0000
- dc.w $0130,$0000,$0132,$0000,$0134,$0000,$0136,$0000
- dc.w $0138,$0000,$013a,$0000,$013c,$0000,$013e,$0000
- wavestart:
- dc.w $4d0f,$fffe,$0108,$0000 ; odd bitplane modulo value
- dc.w $4e0f,$fffe,$0180,$0001,$0182,$0111
- dc.w $4f0f,$fffe,$0180,$0003,$0182,$0333
- dc.w $500f,$fffe,$0180,$0005,$0182,$0555
- dc.w $510f,$fffe,$0180,$0007,$0182,$0777
- dc.w $520f,$fffe,$0180,$0009,$0182,$0999
- dc.w $530f,$fffe,$0180,$000b,$0182,$0aaa
- dc.w $540f,$fffe,$0180,$000d,$0182,$0ddd
- dc.w $550f,$fffe,$0180,$000f,$0182,$0fff
- dc.w $560f,$fffe,$0180,$000d,$0182,$0ddd
- dc.w $570f,$fffe,$0180,$000b,$0182,$0bbb
- dc.w $580f,$fffe,$0180,$0009,$0182,$0999
- dc.w $590f,$fffe,$0180,$0008,$0182,$0888
- dc.w $5a0f,$fffe,$0180,$0007,$0182,$0777
- dc.w $5b0f,$fffe,$0180,$0006,$0182,$0666
- dc.w $5c0f,$fffe,$0180,$0005,$0182,$0555
- dc.w $5d0f,$fffe,$0180,$0004,$0182,$0444
- dc.w $5e0f,$fffe,$0180,$0003,$0182,$0333
- dc.w $5f0f,$fffe,$0180,$0002,$0182,$0222
- dc.w $600f,$fffe,$0180,$0001,$0182,$0111
- waveend:dc.w $610f,$fffe,$0108,$0000,$0180,$0000
- dc.w $0182,$0000
- dc.l -2,-2
-
- Bmap: incbin "fun.raw"
-
- NullSprite: dc.l 0,0,0 ; 2 controll words,2 data words,2 blank word
-